<!--
 * @Author: wjk
 * @Date: 2019-12-31 15:40:51
 * @LastEditors: wangzm
 * @LastEditTime: 2020-03-16 16:03:57
 * @description: file content
 -->
<template>
  <view :style-text="pageStyle">
    <template v-if="!pageLoading">
      <view v-if="isEmpty" class="empty-block">
        <msg-page type="empty_network" text="活动正在准备中~" />
      </view>
      <template v-if="activityData.modules && activityData.modules.length">
        <custom-modules :list="activityData.modules" :scroll-top="scrollTop" />
      </template>
    </template>
    <share-btn v-if="activityConfig.share_login_state && !token" />
    <template v-if="activityData.footer_tabs && activityData.footer_tabs.content_list && activityData.footer_tabs.content_list.length && (activityData.footer_tabs.screenToShow === 0 || showFooterBar)">
      <!-- 占位用的-开始 -->
      <view class="footer-tab hidden">
        <view v-for="(item, index) in activityData.footer_tabs.content_list" :key="index" class="footer-tab-item">
          <b-image :src="item.pic" mode="widthFix" />
        </view>
      </view>
      <!-- 占位用的-结束 -->
      <footer-bar>
        <view class="footer-tab">
          <view v-for="(item, index) in activityData.footer_tabs.content_list" :key="index" class="footer-tab-item" @click="handleFooterTabClick(item)">
            <b-image :src="item.pic" mode="widthFix" />
          </view>
        </view>
      </footer-bar>
    </template>
  </view>
</template>

<script>
import { mapState } from 'vuex'
import MsgPage from '@/components/msgPage'
import CustomModules from '@/components/customModules'
import ShareBtn from '@/components/customModules/modules/shareBtn.vue'
import FooterBar from '@/components/footerBar'
import { toFunctionDetail } from '@/utils/navigateTo'
export default {
  components: {
    MsgPage,
    CustomModules,
    ShareBtn,
    FooterBar
  },
  props: {
    pageStyle: {
      type: String,
      default: ''
    },
    isEmpty: {
      type: Boolean,
      default: false
    },
    pageLoading: {
      type: Boolean,
      default: false
    },
    scrollTop: {
      type: Number,
      default: 0
    },
    showFooterBar: {
      type: Boolean,
      default: false
    },
    activityConfig: {
      type: Object,
      default: () => {
        return {
          modules: []
        }
      }
    },
    activityData: {
      type: Object,
      default: () => {
        return {
          modules: []
        }
      }
    }
  },
  computed: {
    ...mapState([
      'token'
    ])
  },
  methods: {
    // 底部tab点击
    handleFooterTabClick(item) {
      toFunctionDetail(item)
    }
  }
}
</script>
